package application

import (
	"ruoyi-go-echo-ddd/internal/domain/model"
	"ruoyi-go-echo-ddd/internal/domain/service"
	"ruoyi-go-echo-ddd/internal/infrastructure/http/request"

	"github.com/labstack/echo/v4"
)

type SysMenuResourcesApplication struct {
	MenuResourcesService *service.SysMenuResourcesService
}

func NewSysMenuResourcesApplication(s *service.SysMenuResourcesService) *SysMenuResourcesApplication {
	return &SysMenuResourcesApplication{MenuResourcesService: s}
}

func (s *SysMenuResourcesApplication) Insert(e echo.Context, sysMenuResources *model.SysMenuResources) (*model.SysMenuResources, error) {
	return s.MenuResourcesService.Repo.Insert(e.Request().Context(), sysMenuResources)
}

func (s *SysMenuResourcesApplication) Update(e echo.Context, sysMenuResources *model.SysMenuResources) (int64, error) {
	return s.MenuResourcesService.Repo.Update(e.Request().Context(), sysMenuResources)
}

func (s *SysMenuResourcesApplication) BatchInsert(e echo.Context, list []*model.SysMenuResources) ([]int64, error) {
	return s.MenuResourcesService.Repo.BatchInsert(e.Request().Context(), list)
}

func (s *SysMenuResourcesApplication) SelectById(e echo.Context, id int64) (*model.SysMenuResources, error) {
	return s.MenuResourcesService.Repo.SelectById(e.Request().Context(), id)
}

func (s *SysMenuResourcesApplication) SelectPage(e echo.Context, param *request.SysMenuResourcesReq) ([]*model.SysMenuResources, int64, int64, error) {
	return s.MenuResourcesService.Repo.SelectPage(e.Request().Context(), param)
}

func (s *SysMenuResourcesApplication) BatchDelete(e echo.Context, ids []any) (int64, error) {
	return s.MenuResourcesService.Repo.BatchDelete(e.Request().Context(), ids)
}

func (s *SysMenuResourcesApplication) SelectAllForExcel(e echo.Context) ([]*model.SysMenuResources, error) {
	return s.MenuResourcesService.Repo.SelectAllForExcel(e.Request().Context())
}
